var mqtt = require('mqtt')
let mqttConfig = {
    host:'159.75.72.220',
    port:1883
}
var client = mqtt.connect(mqttConfig)

client.on('connect', function () {
    client.subscribe('LJH', function (err) {
        if (!err) {
        }
    })
    client.subscribe('LJH1', function (err) {
        if (!err) {
        }
    })
    client.subscribe('LJH2', function (err) {
        if (!err) {
        }
    })
    client.subscribe('LJHCON1', function (err) {
        if (!err) {
        }
    })
})

client.on('message', function (topic, message) {
    // message is Buffer
    console.log('topic=>', topic);
    console.log(message.toString())
    // client.end()
})
